import jsx from 'acorn-jsx';
import typescript from 'rollup-plugin-typescript2';
import del from 'rollup-plugin-delete';

 const config = {
  input: './src/unstated-solid.tsx',
  output: [{
    file: './lib/index.js',
    format: 'cjs'
  },{
    file: './lib/index.jsx',
    format: 'es'
  }],
  acornInjectPlugins: [jsx()],
  plugins: [
    typescript({ jsx: 'preserve' }),
    del({ targets: ['./lib'] }),
  ],
  watch: {
    include: 'src/**'
  },
  external: ['solid-js'],
}

if(process.env.ENV==='development'){
  // 开发模式构建性能优化，fix windows系统 站点监听bug
  config.output.shift();
  config.plugins.pop();
}

export default config;